package com.caowang.mhtlj.controller;

public class Result<T> {
    private String msg;

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }

    private Integer code;
    private T data;

    protected Result(Integer code,String message, T data) {
        this.code =code;
        this.msg = message;
        this.data = data;
    }
    protected Result(Integer code,String msg) {
        this.code =code;
        this.msg = msg;
    }
    public static <T> Result<T> success(T data) {
        return new Result(200, "success",data);
    }

    public static <T> Result<T> successA(T data){
        return new Result(0, "success",data);
    }

    public static <T> Result<T> fail( String message) {
        return new Result(500,message);
    }

    public static <T> Result<T> failA(String name, String data) {
        return new Result(500,name +"已经坐庄了",data);
    }
}

